class OrderBeautyPartsController < ApplicationController
  def new
  	@order_beauty_part = OrderBeautyPart.new
    @part_styles = PartStyle.all
  end

  def create
  	@order_beauty_part = OrderBeautyPart.new post_params
    if @order_beauty_part.save
       redirect_to order_beauty_path(:id =>@order_beauty_part.order_beauty.id)
    else
      render :action => 'new'
    end
  end

  def destroy
    @order_beauty_part = OrderBeautyPart.find params[:id]
    @order_beauty_part.destroy
    redirect_to order_beauty_path(:id =>@order_beauty_part.order_beauty.id)
  end

   def post_params
    params.require(:order_beauty_part).permit(*%w(order_beauty_id part_id part_style_id qty))
  end
end
